using System;
using System.Threading.Tasks;
using Me.Prettyprint.Cassandra.Service;
using Me.Prettyprint.Cassandra.Utils;
namespace Me.Prettyprint.Cassandra.Connection
{
    /// <summary>
    /// Base class for classes that need to monitor connections and manage
    /// the connection pool.
    /// </summary>
	public abstract class BackgroundCassandraHostService
	{
        protected TaskScheduler scheduler;

        protected internal HConnectionManager connectionManager;
        protected internal CassandraHostConfigurator cassandraHostConfigurator;

        protected Task backgroundTask;
        protected internal int retryDelayInSeconds;

        virtual public int RetryDelayInSeconds
		{
			get
			{
				return retryDelayInSeconds;
			}
			
			set
			{
				this.retryDelayInSeconds = value;
			}
		}
		public BackgroundCassandraHostService(HConnectionManager connectionManager, CassandraHostConfigurator cassandraHostConfigurator)
		{
            scheduler = TaskScheduler.Default;
			this.connectionManager = connectionManager;
			this.cassandraHostConfigurator = cassandraHostConfigurator;
		}
		internal abstract void Shutdown();
		public abstract void ApplyRetryDelay();
	}
}